home *** CD-ROM | disk | FTP | other *** search
/ Aminet 38 / Aminet 38 (2000)(Schatztruhe)[!][Aug 2000].iso / Aminet / dev / misc / intlist.lha / IntList / IntList.doc < prev    next >
Encoding:
Text File  |  2000-03-01  |  9.4 KB  |  234 lines

  1. IntList V3.0
  2.  
  3. Copyright 1996 J.v.d.Loo
  4.  
  5. IntList  3.0  is  a replacement for Commodores (previous Amiga Technologies,
  6. currently  Gateway 2000) IntList for displaying interrupts currently used in
  7. system.
  8.  
  9. I  wondered  myself  each  time  I  wrote  an  interrupt  structure that all
  10. "Listers"  did  not  reflect  my  set  interrupt.  After writing this little
  11. utility  I  know  why: Because I used cia-x-resource interrupts that are not
  12. reflected through the exec-base and thus are not set in an exec list.
  13. Those  interrupts  are  managed by the resource (here cia-x) and only caused
  14. through  an  exec  routine.  This means that cia-x interrupts are not set to
  15. the  exec-base,  but  to the extended resource structure (resource-base). So
  16. the resource-base has to be scanned. This program does it.
  17.  
  18. The  next  that  I  have missed are interrupts that not continue over a long
  19. period,  instead,  only  once called through exec function Cause(). I do not
  20. use  an  interrupt  to examine the exec-field for it; I do it via a patch on
  21. the exec-function Cause() that is removed after the examination is done.
  22.  
  23.  
  24. - Sample IntList output -
  25.  
  26. IntList V3.0 - Based on no one's Guru's Guide
  27. - Copyright 1996 ONIX - Exec should be rewritten...
  28.  
  29. IRQ (TBEmpty Level 1), PRI   0, owner: "serial.device"
  30. IRQ (DSKBLoK Level 1), PRI   0, owner: "disk.resource"
  31. IRQ (PORTS   Level 2), PRI 120, owner: "ciaa.resource"
  32. IRQ (PORTS   Level 2), PRI 100, owner: "VBInt CVision3D (0)"
  33. IRQ (PORTS   Level 2), PRI  21, owner: "atapi.device"
  34. IRQ (PORTS   Level 2), PRI  20, owner: "AT-IDE"
  35. IRQ (PORTS   Level 2), PRI   0, owner: "timer.device",     IVEC 1 = Timer A
  36. IRQ (PORTS   Level 2), PRI   0, owner: "timer.device",     IVEC 2 = Timer B
  37. IRQ (PORTS   Level 2), PRI   0, owner: "timer.device",     IVEC 3 = TOD Alarm
  38. IRQ (PORTS   Level 2), PRI   0, owner: "keyboard.device",  IVEC 4 = Serial Port
  39. IRQ (COPpER  Level 3), PRI   0, owner: ""
  40. IRQ (VERTB   Level 3), PRI  10, owner: "graphics.library"
  41. IRQ (VERTB   Level 3), PRI   0, owner: "gameport.device"
  42. IRQ (VERTB   Level 3), PRI   0, owner: "timer.device"
  43. IRQ (BLITter Level 3), PRI   0, owner: "graphics.library"
  44. IRQ (AUDio 0 Level 4), PRI   0, owner: "audio.device"
  45. IRQ (AUDio 1 Level 4), PRI   0, owner: "audio.device"
  46. IRQ (AUDio 2 Level 4), PRI   0, owner: "audio.device"
  47. IRQ (AUDio 3 Level 4), PRI   0, owner: "audio.device"
  48. IRQ (RBFull  Level 5), PRI   0, owner: "serial.device"
  49. IRQ (DSKSYNC Level 5), PRI   0, owner: "disk.resource"
  50. IRQ (EXTER   Level 6), PRI 120, owner: "ciab.resource"
  51. IRQ (EXTER   Level 6), PRI -16, owner: "noise.library",    IVEC 2 = Timer B
  52. IRQ (EXTER   Level 6), PRI  10, owner: "graphics.library", IVEC 3 = TOD Alarm
  53. IRQ (EXTER   Level 6), PRI   0, owner: "disk.resource",    IVEC 5 = Flag Input 
  54. Scanning for Cause() Level 1 interrupts
  55. Hold on, computing for about one second...
  56.  
  57. IRQ (SOFTINTS Level 1) raised by: "VBInt CVision3D (0)", PRI: 32
  58. IRQ (SOFTINTS Level 1) raised by: "noise.library", PRI: 16
  59.  
  60. - End of sample -
  61.  
  62.  
  63. Cause()  is  often  used  by  high  level  interrupts to start a lower level
  64. interrupt,  e.g.  level-6  (ciab)  Timer-B can be used to cause continuously
  65. every 1/50 sec. a sub-interrupt via function Cause().
  66.  
  67.     CIAx:
  68.         movea.l    A1,A5                ; IS_DATA
  69.         movea.l    Level_1_IRQ(A5),A1
  70.         movea.l    _SysBase(A5),A6
  71.         jsr    _LVOCause(A6)
  72.         moveq    #0,D0
  73.         rts
  74.  
  75.     CAUSE:
  76.         movem.l    D2-D7/A2-A4/A6,-(sp)
  77.         movea.l    A1,A5                ; IS_DATA
  78.         ....
  79.         ....
  80.         movem.l    (sp)+,D2-D7/A2-A4/A6
  81.         moveq    #0,D0
  82.         rts
  83.  
  84. This  has got the advantage that timing conflicts through the use of a cia-b
  85. timer  are minimised. Also device depending things like the audio-device can
  86. now be used from within the interrupt.
  87. The  disadvantages are that soft-interrupts only take precedence over tasks,
  88. but  not over other interrupts. Thus, even you call your soft-interrupt from
  89. an  interrupt  with  a  high  level  (e.g. level 6, cia-b) on a heavy loaded
  90. system  the  soft-interrupt will not work continuously, which will result in
  91. the lost of the control over your interrupt-code!
  92.  
  93. Some notes at this point:
  94. The  v33 through 40 includes do not hold the required things (currently they
  95. are  empty)  and you can only follow the source if you have a KickRom 1.x or
  96. above documented listing - or look here!
  97.  
  98. ---    CIA-Resource structure    --- (CIA = complexe interface adapter)
  99.  
  100. There  are  five  available  vectors that can be used to signal the CPU that
  101. she  should  stop with normal work and switch from user mode into supervisor
  102. mode.
  103.  
  104. Knowledge:
  105. The  CPU offers only three pipes for interrupts ( IPL0, IPL1 and IPL2 : %111
  106. =  7  interrupt  sources) and has got only so called 7 auto-vectors (level 0
  107. through  7) who represent an index equal to the state of IPL0 | IPL1 | IPL2.
  108. From the index to the auto-vector it is a little step:
  109.  
  110. Amiga implementation (memory address (no care about vector base here)):
  111. 0 = no interrupt
  112.     
  113. 1    = $64    level 1    Interrupt caused by DMA-hardware
  114. 2    = $68    level 2    Interrupt caused by CIA-A-hardware
  115. 3    = $6C    level 3    Interrupt caused by DMA-hardware
  116. 4    = $70    level 4    Interrupt caused by DMA-hardware
  117. 5    = $74    level 5    Interrupt caused by DMA-hardware
  118. 6    = $78    level 6    Interrupt caused by CIA-B-hardware
  119. 7    = $7C    level 7    (NMI - cannot be disabled)
  120.  
  121. Seems  pretty  easy,  does  it?  Of course it's a little more complex. I can
  122. mention  here  also FC0, FC1, FC2, VPA and DTACK and that it's possible with
  123. DTACK  to  cause  a  lot  more  hardware interrupts, transferred through the
  124. data-bus  but  this  isn't  implemented for the Amiga, and for understanding
  125. how  the CIAs are implemented into the system it's not necessary. But now we
  126. know  that  the  CPU can only distinguish between an interrupt caused by the
  127. CIA-A  (level  2)  and  CIA-B (level 6) while she itself does not know which
  128. hardware  requested  for  an  interrupt. The only thing she now does (easily
  129. said,  it's again a little more complex) is to call the appropriate routine,
  130. which  is  pointing  to  the  auto-  vector. Auto-vector level-2 points to a
  131. routine,  which  will manage the CIA-A interrupts, while auto-vector level-6
  132. points   to   the   "manager"   for   CIA-B.   These  "managers"  using  the
  133. CIA-x-Resource  to  distinguish  which vector of the CIA hardware has caused
  134. the interrupt.
  135.  
  136. That should be enough for the moment.
  137.  
  138. There  is  only one exec-sever list for each CIA, the interrupt lists itself
  139. are  managed  by  the  CIA-resources, where the exec-server list itself is a
  140. member of them.
  141.  
  142. struct CIAxResource
  143. 0    struct Node LibNode    Normal node, LN_NAME points to resource name
  144. 14    UBYTE    lib_Flags
  145. 15    UBYTE    lib_pad
  146. 16    UWORD    lib_NegSize
  147. 18    UWORD    lib_PosSize
  148. 20    UWORD    lib_Version
  149. 22    UWORD    lib_Revision
  150. 24    STRPTR    lib_IDString
  151. 28    ULONG    lib_Sum
  152. 32    UWORD    lib_OpenCnt
  153. 34    APTR    CiaStartPointer    Pointer to hardware address (CIA-A $BFE001, CIA-B, $BFD000)
  154. 38    WORD    IntReqBits    Bits to set if interrupt is called: CIA-A $8, CIA-B $2000
  155. 40    BYTE    IntEnableCIA    Remembered allowed CIA interrupt
  156. 41    BYTE    IntRequestCIA    Remembered requested CIA interrupt
  157.  
  158. ( OS 1.x unknown state, OS 2.x unknown state, OS 3.x - see notes)
  159. 42 struct Interrupt CIAIRQ (normal node)
  160.     42    struct    Interrupt *NextIRQ Next    Interrupt (if CIA-A & OS 3.x: AT-IDE, CIA-B zero)
  161.     46    struct    Interrupt *PrevIRQ Last    Interrupt
  162.     50    UBYTE    Type            Interrupt
  163.     51    BYTE    PRI            Priority
  164.     52    STRPTR    NAME            Name of this interrupt
  165.     56    APTR    DATA            (IS_DATA)
  166.     60    APTR    CODE            (IS_CODE)
  167.  
  168. ----Now  the  vectors  follow  -  signalled to CPU. Note: the CPU itself can
  169.     only  detect  two  IRQs,  CIA-A (level 2) and CIA-B (level 6), while the
  170.     entries  IntEnableCIA  and  IntRequestCIA  will be investigated to check
  171.     which CIA-x vector caused the IRQ.
  172.  
  173. T I M E R - A    (IVEC = 1)
  174. ( OS 1.x: CIA-A & CIA-B unused by system,
  175.     OS 2.x: unknown state
  176.     OS 3.x: CIA-A used by timer.device, CIA-B unused by system)
  177. 64 struct IntVec TimerA
  178.     64    APTR        IS_DATA
  179.     68    APTR        IS_CODE
  180.     72    struct Node    *IRQNode
  181.  
  182. T I M E R - B    (IVEC = 2)
  183. ( OS 1.x: CIA-A used by timer.device, CIA-B unused by system
  184.     OS 2.x: unknown
  185.     OS 3.x: CIA-A used by timer.device, CIA-B unused by system)
  186. 76 struct IntVec TimerB
  187.     76    APTR        IS_DATA
  188.     80    APTR        IS_CODE
  189.     84    struct Node    *IRQNode
  190.  
  191. T O D - A L A R M    (IVEC = 3)
  192. ( OS 1.x: CIA-A unused by system, CIA-B used by graphics.library
  193.     OS 2.x: unknown,
  194.     OS 3.x: CIA-A used by timer.device, CIA-B used by graphics.library)
  195. 88 struct IntVec TODAlarm
  196.     88    APTR        IS_DATA
  197.     92    APTR        IS_CODE
  198.     96    struct Node    *IRQNode
  199.  
  200. S E R I A L - D A T A    (IVEC = 4)
  201. ( OS 1.x: CIA-A used by keyboard.device, CIA-B unused by system
  202.     OS 2.x: unknown,
  203.     OS 3.x: CIA-A keybord.device, CIA-B unused by system)
  204. 100 struct IntVec SerialData
  205.     100    APTR        IS_DATA
  206.     104    APTR        IS_CODE
  207.     108    struct Node    *IRQNode
  208.  
  209. F L A G - I N P U T    (IVEC = 5)
  210. ( OS 1.x: CIA-A unused by system, CIA-B used by disk.resource
  211.     OS 2.x: unknown,
  212.     OS 3.x: CIA-A unused by system, CIA-B used by disk.resource)
  213. 112 struct IntVec FlagInput
  214.     112    APTR        IS_DATA
  215.     116    APTR        IS_CODE
  216.     120    struct Node    *IRQNode
  217. - END
  218.  
  219. Note  that an Amiga computer can only handle eight interrupts ( 7 + spurious
  220. irq  =  8  )  but  exec  uses each hardware interrupt for several things and
  221. multiple  times!  So  a  normal  A4000  has  ever 13 interrupts running (has
  222. nothing  to  do  with  the  pseudo  interrupts) and if a program requires an
  223. interrupt (sound playing utility) there are at least 18, most of the time 19!
  224.  
  225.  
  226. I  hope  I  explained  the  stuff  so  that you can update your own powerful
  227. system  monitor  with  the new knowledge. But beware: Never make me held for
  228. anything  caused  by  this  little  documentation  nor  through  the  use of
  229. IntList.  Note  also:  the  Draco computer has got no CIAs and I don't think
  230. other future Amiga-ROM compatible machine will have!
  231.  
  232.  
  233.     Joerg
  234.